package com.wtone.platform.gat.images.gat.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSort;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.wtone.platform.gat.images.gat.model.*;
import com.wtone.platform.gat.images.gat.service.RegisterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Author: aiLin
 * @Date: 2020/9/25 16:48
 * @desc: 注册中心
 */
@Api(tags = "注册中心", value = "login api")
@ApiSort(1)
@RestController
@Slf4j
public class RegisterController {

    @Autowired
    private RegisterService registerService;

    @ApiOperation("注册接口")
    @ApiOperationSort(value = 1)
    @PostMapping("/VIID/System/Register")
    public ResponseStatusObject register(@RequestBody RegisterObject registerObject){
        log.info("/VIID/System/Register:"+registerObject.toString());
        return registerService.register(registerObject);
    }

    @ApiOperation("注销接口")
    @ApiOperationSort(value = 2)
    @PostMapping("/VIID/System/UnRegister")
    public ResponseStatusObject unRegister(@RequestBody UnRegisterObject unRegisterObject){
        return registerService.unRegister(unRegisterObject);
    }

    @ApiOperation("心跳接口")
    @ApiOperationSort(value = 3)
    @PostMapping("/VIID/System/Keepalive")
    public ResponseStatusObject keepalive(@RequestBody KeepaliveObject keepaliveObject){
        log.info("/VIID/System/Keepalive:"+keepaliveObject.toString());
        return registerService.keepalive(keepaliveObject);
    }
}
